#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void PrintMatrix(float arr[5][5], int num)
{
	int i, j;
	for (i = 0; i <= num - 1; i++)
	{
		for (j = 0; j <= num - 1; j++)
		{
			printf("%10.2f", arr[i][j]);
		}
		printf("\n");
	}
}

int main ()
{
	float TwoDimArray[5][5];
	int i, j;
//	srand(5);
	srand( (unsigned)time( NULL ) );
	for (i = 0; i <= 4; i++)
	{
		for (j = 0; j <= 4; j++)
		{
			TwoDimArray[i][j] = rand() % 10;
		}
	}
	PrintMatrix(TwoDimArray, 5);
	//sum
	float sum = 0;
	for (int k = 0; k <= 4; k++)
	{
		sum += TwoDimArray[k][k];
	}
	printf("\nThe sum is %10.2f \n", sum);
}



